package com.hutianao.gqgl.post.service.impl;

import com.hutianao.gqgl.mybatis.entity.PtJobEntity;
import com.hutianao.gqgl.mybatis.entity.PtPostEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PadingRstType;
import com.hutianao.gqgl.mybatis.entity.PtMenuEntity;
import com.hutianao.gqgl.mybatis.ztree.ZtreeEntity;
import com.hutianao.gqgl.post.entity.SearchPostEntity;
import com.hutianao.gqgl.post.repository.PostDao;
import com.hutianao.gqgl.post.service.PostService;
import com.hutianao.gqgl.spring.control.BaseController;
import com.hutianao.gqgl.spring.tag.entity.DictTagEntity;
import org.apache.ibatis.annotations.Param;
import com.hutianao.gqgl.spring.util.DataUitl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;

import java.util.List;

@Service
public class PostServiceImpl extends BaseController implements PostService {
    @Autowired
    private PostDao postDao;

    @Override
    public List<ZtreeEntity> queryLeftOrganTree(){
        List<ZtreeEntity> list=postDao.queryLeftOrganTree();

        return list;
    }

    @Override
    public PadingRstType<PtPostEntity> queryPostInfoListByOrgan(SearchPostEntity search, PaddingEntity padding){
        padding.deal(PtPostEntity.class);
        PadingRstType<PtPostEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(padding.getPage());
        List<PtPostEntity> list =postDao.queryPostInfoListByOrgan(search, padding);
        padingRstType.setRawRecords(list);
        Integer total =postDao.queryPostInfoTotal(search);
        padingRstType.setTotal(total);
        padingRstType.putItems();

        return padingRstType;
    }
    @Override
    public PtPostEntity queryPostInfoById(@Param("dutyId") String dutyId){
        return postDao.queryPostInfoById(dutyId);
    }

    @Override
    public List<DictTagEntity> queryRoleList(){
        return postDao.queryRoleList();
    };
    @Override
    public List<DictTagEntity> queryOrganList(){
        return postDao.queryOrganList();
    };


}
